package nsu.edu.zsq.service.impl.student;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import nsu.edu.zsq.common.RequestHolder;
import nsu.edu.zsq.dao.ExamStudentMapper;
import nsu.edu.zsq.dao.ResitExamStudentMapper;
import nsu.edu.zsq.exception.ParamException;
import nsu.edu.zsq.service.student.ExamInfoService;

/** 
* Description: <br>
*/
@Service
public class ExamInfoServiceImpl implements ExamInfoService {
    
    @Autowired
    private ExamStudentMapper examStudentMapper;
    @Autowired
    private ResitExamStudentMapper resitExamStudentMapper;

    @Override
    public List<Map<String, Object>> listExamStudent() {
        List<Map<String, Object>> listExamInfo = examStudentMapper.listExamInfo(RequestHolder.getCurrentStudent().getStuNo());
        if (listExamInfo.size() <= 0) {
            throw new ParamException("暂无考试安排信息");
        }
        return listExamInfo;
    }

    @Override
    public List<Map<String, Object>> listResitExamStudent() {
        List<Map<String, Object>> listResitExamInfo = resitExamStudentMapper.getResitExamInfo(RequestHolder.getCurrentStudent().getStuNo());
        if (listResitExamInfo.size() <= 0) {
            throw new ParamException("暂无补考安排信息");
        }
        return listResitExamInfo;
    }

}
